package org.shj.pattern.status

abstract class State {
    
  def handleCall(context: Context)
}

class ShutdownState extends State{
  def handleCall(context: Context){
    if(context.currentStatus == "关机"){
      println("用户已关机")
    }else{
      context.state = new OpenState()
      context.requestCall()
    }
  }
}

class OpenState extends State{
  def handleCall(context: Context){
    if(context.currentStatus == "欠费"){
      context.state = new QianFeiState()
      context.requestCall()
    }else{
      println("正在拨打用户")
    }
  }
}

class QianFeiState extends State{
  def handleCall(context: Context){
    println("用户欠费停机")
  }
}